package com.minimalist.common.entity.lindi.po;

import com.minimalist.common.config.mybatis.InsertFullColumnHandler;
import com.minimalist.common.config.mybatis.UpdateFullColumnHandler;
import com.minimalist.common.config.mybatis.bo.BaseEntity;
import com.mybatisflex.annotation.Table;
import java.io.Serial;
import java.io.Serializable;
import java.util.Objects;

/**
 * 林地指标平台_合同模板字段配置表 实体类。
 *
 * @author 11987
 * @since 2025-05-31
 */
@Table(value = "LINDI_CONTRACT_TEMPLATE_FIELD", onInsert = InsertFullColumnHandler.class, onUpdate = UpdateFullColumnHandler.class)
public class LindiContractTemplateField extends BaseEntity implements Serializable{

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 合同模板字段配置ID
     */
    private Long contractTemplateFieldId;

    /**
     * 合同模板ID
     */
    private Long contractTemplateId;

    /**
     * 字段名称
     */
    private String fieldName;

    /**
     * 字段标识
     */
    private String fieldKey;

    /**
     * 字段类型(text:文本, number:数字, date:日期, select:下拉选择)
     */
    private String fieldType;

    /**
     * 是否必填(0:选填, 1:必填)
     */
    private Integer fieldRequire;

    /**
     * 页码
     */
    private Integer pageNumber;

    /**
     * X坐标
     */
    private String positionX;

    /**
     * Y坐标
     */
    private String positionY;

    /**
     * 排序序号
     */
    private String sortOrder;

    /**
     * 默认值
     */
    private String defaultValue;

    /**
     * 文本域名称
     */
    private String textFieldName;

    public LindiContractTemplateField() {
    }

    public LindiContractTemplateField(Long contractTemplateFieldId, Long contractTemplateId, String fieldName, String fieldKey, String fieldType, Integer fieldRequire, Integer pageNumber, String positionX, String positionY, String sortOrder, String defaultValue, String textFieldName) {
        this.contractTemplateFieldId = contractTemplateFieldId;
        this.contractTemplateId = contractTemplateId;
        this.fieldName = fieldName;
        this.fieldKey = fieldKey;
        this.fieldType = fieldType;
        this.fieldRequire = fieldRequire;
        this.pageNumber = pageNumber;
        this.positionX = positionX;
        this.positionY = positionY;
        this.sortOrder = sortOrder;
        this.defaultValue = defaultValue;
        this.textFieldName = textFieldName;
    }

    public Long getContractTemplateFieldId() {
        return contractTemplateFieldId;
    }

    public void setContractTemplateFieldId(Long contractTemplateFieldId) {
        this.contractTemplateFieldId = contractTemplateFieldId;
    }

    public Long getContractTemplateId() {
        return contractTemplateId;
    }

    public void setContractTemplateId(Long contractTemplateId) {
        this.contractTemplateId = contractTemplateId;
    }

    public String getFieldName() {
        return fieldName;
    }

    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }

    public String getFieldKey() {
        return fieldKey;
    }

    public void setFieldKey(String fieldKey) {
        this.fieldKey = fieldKey;
    }

    public String getFieldType() {
        return fieldType;
    }

    public void setFieldType(String fieldType) {
        this.fieldType = fieldType;
    }

    public Integer getFieldRequire() {
        return fieldRequire;
    }

    public void setFieldRequire(Integer fieldRequire) {
        this.fieldRequire = fieldRequire;
    }

    public Integer getPageNumber() {
        return pageNumber;
    }

    public void setPageNumber(Integer pageNumber) {
        this.pageNumber = pageNumber;
    }

    public String getPositionX() {
        return positionX;
    }

    public void setPositionX(String positionX) {
        this.positionX = positionX;
    }

    public String getPositionY() {
        return positionY;
    }

    public void setPositionY(String positionY) {
        this.positionY = positionY;
    }

    public String getSortOrder() {
        return sortOrder;
    }

    public void setSortOrder(String sortOrder) {
        this.sortOrder = sortOrder;
    }

    public String getDefaultValue() {
        return defaultValue;
    }

    public void setDefaultValue(String defaultValue) {
        this.defaultValue = defaultValue;
    }

    public String getTextFieldName() {
        return textFieldName;
    }

    public void setTextFieldName(String textFieldName) {
        this.textFieldName = textFieldName;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        LindiContractTemplateField that = (LindiContractTemplateField) o;
        return Objects.equals(contractTemplateFieldId, that.contractTemplateFieldId) &&
                Objects.equals(contractTemplateId, that.contractTemplateId) &&
                Objects.equals(fieldName, that.fieldName) &&
                Objects.equals(fieldKey, that.fieldKey) &&
                Objects.equals(fieldType, that.fieldType) &&
                Objects.equals(fieldRequire, that.fieldRequire) &&
                Objects.equals(pageNumber, that.pageNumber) &&
                Objects.equals(positionX, that.positionX) &&
                Objects.equals(positionY, that.positionY) &&
                Objects.equals(sortOrder, that.sortOrder) &&
                Objects.equals(defaultValue, that.defaultValue) &&
                Objects.equals(textFieldName, that.textFieldName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), contractTemplateFieldId, contractTemplateId, fieldName, fieldKey, fieldType, fieldRequire, pageNumber, positionX, positionY, sortOrder, defaultValue, textFieldName);
    }

    @Override
    public String toString() {
        return "LindiContractTemplateField{" +
                "contractTemplateFieldId=" + contractTemplateFieldId +
                ", contractTemplateId=" + contractTemplateId +
                ", fieldName='" + fieldName + '\'' +
                ", fieldKey='" + fieldKey + '\'' +
                ", fieldType='" + fieldType + '\'' +
                ", fieldRequire=" + fieldRequire +
                ", pageNumber=" + pageNumber +
                ", positionX='" + positionX + '\'' +
                ", positionY='" + positionY + '\'' +
                ", sortOrder='" + sortOrder + '\'' +
                ", defaultValue='" + defaultValue + '\'' +
                ", textFieldName='" + textFieldName + '\'' +
                '}';
    }

    public static Builder builder() {
        return new Builder();
    }

    public static class Builder {
        private Long contractTemplateFieldId;
        private Long contractTemplateId;
        private String fieldName;
        private String fieldKey;
        private String fieldType;
        private Integer fieldRequire;
        private Integer pageNumber;
        private String positionX;
        private String positionY;
        private String sortOrder;
        private String defaultValue;
        private String textFieldName;

        public Builder contractTemplateFieldId(Long contractTemplateFieldId) {
            this.contractTemplateFieldId = contractTemplateFieldId;
            return this;
        }

        public Builder contractTemplateId(Long contractTemplateId) {
            this.contractTemplateId = contractTemplateId;
            return this;
        }

        public Builder fieldName(String fieldName) {
            this.fieldName = fieldName;
            return this;
        }

        public Builder fieldKey(String fieldKey) {
            this.fieldKey = fieldKey;
            return this;
        }

        public Builder fieldType(String fieldType) {
            this.fieldType = fieldType;
            return this;
        }

        public Builder fieldRequire(Integer fieldRequire) {
            this.fieldRequire = fieldRequire;
            return this;
        }

        public Builder pageNumber(Integer pageNumber) {
            this.pageNumber = pageNumber;
            return this;
        }

        public Builder positionX(String positionX) {
            this.positionX = positionX;
            return this;
        }

        public Builder positionY(String positionY) {
            this.positionY = positionY;
            return this;
        }

        public Builder sortOrder(String sortOrder) {
            this.sortOrder = sortOrder;
            return this;
        }

        public Builder defaultValue(String defaultValue) {
            this.defaultValue = defaultValue;
            return this;
        }

        public Builder textFieldName(String textFieldName) {
            this.textFieldName = textFieldName;
            return this;
        }

        public LindiContractTemplateField build() {
            return new LindiContractTemplateField(contractTemplateFieldId, contractTemplateId, fieldName, fieldKey, fieldType, fieldRequire, pageNumber, positionX, positionY, sortOrder, defaultValue, textFieldName);
        }
    }
}
